for (i=0;i<paramPtr->paramCount;i++) HUnlock (paramPtr->params[i]);
return;
}
pascal void main(paramPtr)
XCmdBlockPtr paramPtr;
/* this is the entry point for the XFCN */
{
RememberA0();
SetUpA4(); /* to access globals */
FindKey(paramPtr); /* run the main event loop */
RestoreA4();
return;
}
-- part contents for card part 9
----- text -----
FindKey version 1.0
Roger Brown
This is a HyperCard XFCN that locates a target string in a specified item of an input field (or other container) and returns the byte position in the field, the number of the line where it was found, and the byte position in that line.
Case sensitivity is used if an optional fourth parameter is "true". An optional fifth parameter can be sent to specify the byte position in the field where the search should start.
INVOKING FindKey
get FindKey (container,target,items,"true",
startByte)
where container is any HyperCard
container (field, variable),
presumed to be
multi-lined.
target is the string to look for
items an item list of numbers
that designate item
positions to look in (
defaults to 1)
true is an optional parameter
turning on case sensitivity
startByte is an optional parameter
specifying the byte
position in the container
where the search should
start.
returns: item 1: byte offset in field or 0 if
not found
item 2: line of card field 1 that
contains the target string
or 0
item 3: byte position in the line or 0
item 4: the item where it was found
EXAMPLE
ex. get FindKey(card field 1,"***","3,4")
This example will look in card field 1 for the first occurrence of the string *** in item 3 or item 4 of any line.